package com.lxx.modules.sys.entity;

import com.lxx.common.BaseEntity;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;



/**
 *  实体类
 *
 * @author lxx
 */
public class SysUser extends BaseEntity<Integer>  {
    /** 用户名 */
	@NotBlank
	@Size(min=3, max=30)
    private String username;

    /** 密码 */
	@NotBlank
	@Size(min=3, max=30)
    private String password;

    /** 用户姓名 */
	@Size(min=1, max=50)
    private String fullName;

    /** Email */
	@NotBlank
	@Size(max=50)
	@Email
    private String email;

    /** 手机号 */
    @NotBlank
    @Size(max=50)
    private String phone;

    /** 最后一次登陆IP */
    private String lastLoginIp;

    /** 性别，0-女，1-男 */
    private String gender;

    /** 最后一次登陆时间 */
    private Date lastLoginTime;

    /** 状态，1-启用，0-停用 */
    private String status;
    
    @NotBlank
    private String roleIds;
    
    private List<SysPermission> permissions;
    
    private String captcha;

    /**
     * 返回 用户名
     *
     * @return 用户名
     */
    public String getUsername() {
        return username;
    }

    /**
     * 设置 用户名
     *
     * @param username 用户名
     */
    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    /**
     * 返回 密码
     *
     * @return 密码
     */
    public String getPassword() {
        return password;
    }

    /**
     * 设置 密码
     *
     * @param password 密码
     */
    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    /**
     * 返回 用户姓名
     *
     * @return 用户姓名
     */
    public String getFullName() {
        return fullName;
    }

    /**
     * 设置 用户姓名
     *
     * @param fullName 用户姓名
     */
    public void setFullName(String fullName) {
        this.fullName = fullName == null ? null : fullName.trim();
    }

    /**
     * 返回 Email
     *
     * @return Email
     */
    public String getEmail() {
        return email;
    }

    /**
     * 设置 Email
     *
     * @param email Email
     */
    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    /**
     * 返回 手机号
     *
     * @return 手机号
     */
    public String getPhone() {
        return phone;
    }

    /**
     * 设置 手机号
     *
     * @param phone 手机号
     */
    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    /**
     * 返回 最后一次登陆IP
     *
     * @return 最后一次登陆IP
     */
    public String getLastLoginIp() {
        return lastLoginIp;
    }

    /**
     * 设置 最后一次登陆IP
     *
     * @param lastLoginIp 最后一次登陆IP
     */
    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp == null ? null : lastLoginIp.trim();
    }

    /**
     * 返回 性别，0-女，1-男
     *
     * @return 性别，0-女，1-男
     */
    public String getGender() {
        return gender;
    }

    /**
     * 设置 性别，0-女，1-男
     *
     * @param gender 性别，0-女，1-男
     */
    public void setGender(String gender) {
        this.gender = gender == null ? null : gender.trim();
    }

    /**
     * 返回 最后一次登陆时间
     *
     * @return 最后一次登陆时间
     */
    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    /**
     * 设置 最后一次登陆时间
     *
     * @param lastLoginTime 最后一次登陆时间
     */
    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    /**
     * 返回 状态，1-启用，0-停用
     *
     * @return 状态，1-启用，0-停用
     */
    public String getStatus() {
        return status;
    }

    /**
     * 设置 状态，1-启用，0-停用
     *
     * @param status 状态，1-启用，0-停用
     */
    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(String roleIds) {
		this.roleIds = roleIds;
	}

	public List<SysPermission> getPermissions() {
		return permissions;
	}

	public void setPermissions(List<SysPermission> permissions) {
		this.permissions = permissions;
	}

	public String getCaptcha() {
		return captcha;
	}

	public void setCaptcha(String captcha) {
		this.captcha = captcha;
	}

	@Override
	public String toString() {
		return "SysUser [username=" + username + ", password=" + password + ", fullName=" + fullName + ", email="
				+ email + ", phone=" + phone + ", lastLoginIp=" + lastLoginIp + ", gender=" + gender
				+ ", lastLoginTime=" + lastLoginTime + ", status=" + status + ", roleIds=" + roleIds + ", permissions="
				+ permissions + ", captcha=" + captcha + "]";
	}

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysUser other = (SysUser) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getFullName() == null ? other.getFullName() == null : this.getFullName().equals(other.getFullName()))
            && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail()))
            && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag()))
            && (this.getLastLoginIp() == null ? other.getLastLoginIp() == null : this.getLastLoginIp().equals(other.getLastLoginIp()))
            && (this.getGender() == null ? other.getGender() == null : this.getGender().equals(other.getGender()))
            && (this.getLastLoginTime() == null ? other.getLastLoginTime() == null : this.getLastLoginTime().equals(other.getLastLoginTime()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getFullName() == null) ? 0 : getFullName().hashCode());
        result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode());
        result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode());
        result = prime * result + ((getLastLoginIp() == null) ? 0 : getLastLoginIp().hashCode());
        result = prime * result + ((getGender() == null) ? 0 : getGender().hashCode());
        result = prime * result + ((getLastLoginTime() == null) ? 0 : getLastLoginTime().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }
}